<h1>Listing photos</h1>

<table>
  <tr>
    <th>ID</th>
    <th>Image</th>
    <th>User</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @photos.each do |photo| %>
  <tr>
    <td><%= photo.id %></td>
    <td><%= image_tag(photo.image.url) if !photo.image.blank? %></td>
    <td><%= photo.user.login if !photo.user.blank? %></td>
    <td><%= link_to 'Destroy', cpanel_photo_path(photo), :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>
<%= will_paginate @photos %>
<br />

<%= link_to 'New Photo', new_cpanel_photo_path %>
